const mongoose = require('mongoose');

const poiSchema = new mongoose.Schema({
  name: { type: String, required: true },
  type: { 
    type: String,
    enum: ['recycle', 'compost', 'hazardous', 'donation'],
    required: true
  },
  location: {
    type: {
      type: String,
      enum: ['Point'],
      required: true
    },
    coordinates: {
      type: [Number],
      required: true
    }
  },
  operatingHours: String,
  contact: String
}, { timestamps: true });

const subscriptionSchema = new mongoose.Schema({
  userId: { 
    type: mongoose.Schema.Types.ObjectId,
    ref: 'User',
    required: true
  },
  categories: [{
    type: String,
    enum: ['workshop', 'cleanup', 'protest', 'fundraiser']
  }],
  notificationPrefs: {
    email: Boolean,
    push: Boolean,
    sms: Boolean
  }
}, { timestamps: true });

module.exports = {
  POI: mongoose.model('POI', poiSchema),
  Subscription: mongoose.model('Subscription', subscriptionSchema)
};